home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / sftwist.lha / modplayer.h < prev    next >
C/C++ Source or Header  |  1993-07-21  |  6KB  |  160 lines

  1. /* C definitions for using the 'modplayer.a' and 'mod8player.a'
  2.    play-routines of OctaMED V2.00 and MED V3.20 */
  3.  
  4. #ifndef EXEC_TYPES_H
  5. #include <exec/types.h>
  6. #endif
  7.  
  8. /* If "libproto.h" has been loaded, we don't define the "modplayer.a"
  9.    functions. */
  10. #ifndef MEDPLAYER_LIBPROTO
  11. #ifdef LATTICE
  12. /* In 'modplayer.a' */
  13. LONG __asm InitPlayer(void);
  14. void __asm RemPlayer(void);
  15. void __asm PlayModule(register __a0 struct MMD0 *);
  16. void __asm ContModule(register __a0 struct MMD0 *);
  17. void __asm StopPlayer(void);
  18. void __asm SetTempo(register __d0 UWORD);
  19. /* In 'loadmod.a' */
  20. struct MMD0 * __asm LoadModule(register __a0 char *);
  21. /*void __asm RelocModule(register __a0 struct MMD0 *);*/
  22. void RelocModule(register struct MMD0 *);
  23. void __asm UnLoadModule(register __a0 struct MMD0 *);
  24. /* These are the definitions for the 8-channel OctaMED routines,
  25.    in 'mod8player.a' (not provided with MED). */
  26. LONG __asm InitPlayer8(void);
  27. void __asm RemPlayer8(void);
  28. void __asm PlayModule8(register __a0 struct MMD0 *);
  29. void __asm ContModule8(register __a0 struct MMD0 *);
  30. void __asm StopPlayer8(void);
  31. #endif
  32.  
  33. /* If you're playing multi-modules, set the 'modnum' variable to the
  34.    number of the song you want to play before calling PlayModule(). */
  35.  
  36. #ifdef LATTICE_50
  37. extern UWORD far modnum;
  38.  
  39. /* 'modnum8' is the equivalent in 'mod8player' */
  40.  
  41. extern UWORD far modnum8;
  42. #else
  43. extern UWORD modnum,modnum8; /* for less intelligent compilers */
  44. #endif
  45.  
  46. #endif // MEDPLAYER_LIBPROTO
  47.  
  48. /* This is the main module structure */
  49. struct MMD0 {
  50.     ULONG    id;            /* "MMD0" */
  51.     ULONG    modlen;            /* module length (in bytes) */
  52.     struct    MMD0song *song;        /* pointer to MMD0song */
  53.     ULONG    songlen;        /* length of song (not currently used) */
  54.     struct    MMD0block **blockarr;    /* pointer to pointers of blocks */
  55.     ULONG    blockarrlen;        /* length... */
  56.     struct    Soitin **smplarr;    /* pointer to pointers of samples */
  57.     ULONG    smplarrlen;        /* len.. */
  58.     struct    MMD0exp *expdata;    /* pointer to expansion data */
  59.     ULONG    expsize;        /* lenght again.. */
  60. /* The following values are used by the play routine */
  61.     UWORD    pstate;            /* the state of the player */
  62.     UWORD    pblock;            /* current block */
  63.     UWORD    pline;            /* current line */
  64.     UWORD    pseqnum;        /* current # of playseqlist */
  65.     WORD    actplayline;        /* OBSOLETE!! DON'T TOUCH! */
  66.     UBYTE    counter;        /* delay between notes */
  67.     UBYTE    extra_songs;        /* number of additional songs, see
  68.                        expdata->nextmod */
  69. };
  70.  
  71. /* These are the structures for future expansions */
  72.  
  73. struct InstrExt {    /* This struct only for data required for playing */
  74. /* NOTE: THIS STRUCTURE MAY GROW IN THE FUTURE, TO GET THE CORRECT SIZE,
  75.    EXAMINE mmd0->expdata->s_ext_entrsz */
  76.     UBYTE hold;
  77.     UBYTE decay;
  78.     UBYTE suppress_midi_off;    /* 1 = suppress, 0 = don't */
  79.     UBYTE pad0;            /* This may be used in the future... */
  80. };
  81.  
  82. struct MMDInstrInfo {
  83.     UBYTE    name[40];
  84.     UBYTE    pad0;    /* two pads? */
  85.     UBYTE    pad1;
  86. };
  87.  
  88. struct MMD0exp {
  89.     struct MMD0 *nextmod;        /* for multi-modules */
  90.     struct InstrExt *exp_smp;    /* pointer to an array of InstrExts */
  91.     UWORD  s_ext_entries;        /* # of InstrExts in the array */
  92.     UWORD  s_ext_entrsz;        /* size of an InstrExt structure */
  93.     UBYTE  *annotxt;        /* 0-terminated message string */
  94.     ULONG  annolen;            /* length (including the 0-byte) */
  95. /* MED V3.20 data below... */
  96.     struct MMDInstrInfo *iinfo;    /* "secondary" InstrExt for info,
  97.                     that has no affection on output */
  98.     UWORD  i_ext_entries;        /* # of MMDInstrInfos */
  99.     UWORD  i_ext_entrsz;        /* size of one */
  100.     ULONG  jumpmask;        /* jumpmask for Topi (aaaarrrgh!!!) */
  101.     UWORD  *rgbtable;        /* pointer to 8 UWORD values */
  102.     UBYTE  channelsplit[4];    /* for OctaMED only (non-zero = NOT splitted) */
  103. /* leave these to zero! */
  104.     struct NotationInfo *n_info;    /* OctaMED notation editor info data */
  105. /* This are still left, they must be 0 at the moment. */
  106.     ULONG  reserved2[10]; /* better have enough of these... */
  107. };
  108.  
  109. /* Info for each instrument (mmd0->song.sample[xx]) */
  110.  
  111. struct MMD0sample {
  112.     UWORD rep,replen;    /* repeat/repeat length */
  113.     UBYTE midich;        /* midi channel for curr. instrument */
  114.     UBYTE midipreset;    /* midi preset (1 - 128), 0 = no preset */
  115.     UBYTE svol;        /* default volume */
  116.     BYTE strans;        /* sample transpose */
  117. };
  118.  
  119. /* The song structure (mmd0->song) */
  120.  
  121. struct MMD0song {
  122.     struct MMD0sample sample[63];    /* info for each instrument */
  123.     UWORD    numblocks;        /* number of blocks in this song */
  124.     UWORD    songlen;        /* number of playseq entries */
  125.     UBYTE    playseq[256];        /* the playseq list */
  126.     UWORD    deftempo;        /* default tempo */
  127.     BYTE    playtransp;        /* play transpose */
  128.     UBYTE    flags;            /* flags (see below) */
  129.     UBYTE    reserved;        /* for future expansion */
  130.     UBYTE    tempo2;            /* 2ndary tempo (delay betw. notes) */
  131.     UBYTE    trkvol[16];        /* track volume */
  132.     UBYTE    mastervol;        /* master volume */
  133.     UBYTE    numsamples;        /* number of instruments */
  134. }; /* length = 788 bytes */
  135.  
  136.  /* FLAGS of the above structure */
  137. #define    FLAG_FILTERON    0x1    /* hardware low-pass filter */
  138. #define    FLAG_JUMPINGON    0x2    /* jumping.. */
  139. #define    FLAG_JUMP8TH    0x4    /* jump 8th.. */
  140. #define    FLAG_INSTRSATT    0x8    /* instruments are attached (sng+samples)
  141.                    used only in saved MED-songs */
  142. #define    FLAG_VOLHEX    0x10    /* volumes are represented as hex */
  143. #define FLAG_STSLIDE    0x20    /* no effects on 1st timing pulse (STS) */
  144. #define FLAG_8CHANNEL    0x40    /* OctaMED 8 channel song, examine this bit
  145.                    to find out which routine to use */
  146. /* flags in struct NotationInfo */
  147. #define NFLG_FLAT 1
  148. #define NFLG_3_4  2
  149.  
  150. struct NotationInfo {
  151.     UBYTE n_of_sharps;    /* number of #'s (or b's) */
  152.     UBYTE flags;        /* flags (see above) */
  153.     WORD  trksel[5];    /* selected track for each preset (-1 = none) */
  154.     UBYTE trkshow[16];    /* which tracks to show (bit 0 = for preset 0,
  155.                 bit 1 for preset 1 and so on..) */
  156.     UBYTE trkghost[16];    /* ghosted tracks (like trkshow[]) */
  157.     BYTE  notetr[63];       /* -24 - +24 (if bit #6 is negated, hidden) */
  158.     UBYTE pad;    /* perhaps info about future extensions */
  159. };
  160.